package com.ithuaxin.array;

import java.util.Random;

public class Test8 {
    public static void main(String[] args) {
        int arr[] = new int[10];
        Random random = new Random();
        int sum = 0;
        int avg = 0;
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
           arr[i] =  random.nextInt(100) + 1;
           sum = sum +arr[i];
           System.out.println(arr[i]);
        }
        avg = sum / arr.length;
        for (int j = 0; j < arr.length; j++) {
            if (arr[j] < avg) {
                count++;
            }
        }
        System.out.println("这个数组中的和是："+sum);
        System.out.println("这个数组中的平均值是："+avg);
        System.out.println("这个数组中比平均值小的数值有："+count+"个");
    }
}
